//@flow

/**
 * 广告页
 */

import React, { Component } from 'react';
import { 
    View,
    Text,
    TouchableOpacity,
    Image,
 } from 'react-native';
import { ADCountDown } from './adCountDown';
import { safeAreaHOC } from '../../base/safeAreaHOC';
import { NavBar } from '../../container/navBar';
import { ADModal } from './adModal';
import { ADType } from './adType';
import { Navigate } from '../../common/navigate';

export class AD extends Component {

    /**渲染广告主题 */
    renderAD(modal:ADModal){
        switch(modal.adType()){
            case ADType.IMAGE:
                // return ()
            case ADType.VIDEO:
                // return ()
            default :
                // console.warn(`没有该广告类型:${modal.adType()}`)
                return (<Text>没有该广告类型:{modal.adType()}</Text>)
        }
    }
    /**渲染图片广告 */
    renderImgAD(){

    }
    /**渲染视频广告 */
    renderVideoAD(){

    }
    /**界面消失动画 */
    onPageDismiss(){
        
    }
    /**界面加载完成，如果没有任何广告内容直接 */
    componentDidMount(){
        // Navigate.navigate('Login')
    }
    /**渲染 */
    render(){
        return (
            <View >
                {/* 广告主体 */}
                <View style={{width:'100%',height:'100%',backgroundColor: 'white',alignItems:'center',justifyContent:'center'}}>
                    {/* {this.renderAD()} */}
                    <Text>this is AD page</Text>
                </View>
                {/* 广告预加载+倒计时+跳过按钮 */}
                <View style={{position:"absolute",}}>
                    <ADCountDown
                                onPlayEnd={()=>{
                                    Navigate.navigate('Login')
                                }} 
                                timeLong={2}
                                style={{
                                    width:'100%',
                                    height:50,
                                    //  backgroundColor: 'red',
                                    paddingRight:20,
                                    justifyContent:'flex-end'
                                }}/>
                </View>
                
            </View>
        )
    }
}